﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>解构插槽prop</title>
</head>
<body>

    <div id="app">
        <current-verse>
            <template v-slot="{verse: poetry}">
                {{ poetry.firstContent }} <br>
                {{ poetry.secondContent }}
            </template>
        <current-verse>
    </div>

<!--引入vue文件-->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
    const vm = Vue.createApp({ });
    vm.component('currentVerse', {
        template: ' <span><slot :verse="verse">{{ verse.lastContent }}</slot></span>',
        data:function() {
            return {
                verse: {
                    firstContent: '此心随去马，迢递过千峰。',
                    secondContent: '野渡波摇月，空城雨翳钟。',
                }
            }
        }
    });
    vm.mount('#app')
</script>
</body>
</html>
